//
// Created by Zhangwj on 2023/9/27.
//

#include "UnaryOpNode.h"

std::unique_ptr<UnaryOpNode> UnaryOpNode::UnaryOpParser(Parser &parser) {
    // UnaryOp → '+' | '−' | '!'
    std::unique_ptr<UnaryOpNode> unaryOpNode = std::make_unique<UnaryOpNode>();
    if (parser.getLexType(0) == LexType::PLUS || parser.getLexType(0) == LexType::MINU ||
        parser.getLexType(0) == LexType::NOT) {
        unaryOpNode->type = parser.getLexType(0);
        parser.next();
    }
    return unaryOpNode;
}
